#include <bits/stdc++.h>
using namespace std;
using uint=unsigned int;
using ll=long long;
using ull=unsigned long long;
using i128=__int128;
const int N=1e6+5;

int n,m,ans=0;
int a[13];
vector<int> res;

void dfs(int x){
    if(x>n){
        for(int i=1;i<=n;i++){
            res.push_back(a[i]);
        }
        ans++;
        res.push_back(-1);
        return;
    }
    for(int i=a[x-1]+10;i<=m-(n-x)*10;i++){
        a[x]=i;
        dfs(x+1);
    }
    return;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cin>>n>>m;
    a[0]=-9;
    dfs(1);
    cout<<ans<<endl;
    for(auto ele:res){
        if(ele==-1)cout<<endl;
        else cout<<ele<<" ";
    }
    

    return 0;
}